import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state:{
		hasLogin:false,
		userInfo:{},
		token:'',
		buyCarList:[],
		buycarnum:'',
		picPath:''
	},
	mutations:{
		login(state, provider){
			state.hasLogin = true;
			state.userInfo = provider.content;
			state.token = provider.token
			// uni.setStorage({
			// 	key:'userInfo',
			// 	data:provider,
			// })
			console.log(state.userInfo)
			console.log(state.token)
		},
		setpath(state, sxxx){
			state.picPath = sxxx;
		},
		logout(state){
			state.hasLogin = false;
			state.userInfo = {};
			state.token = '';
			uni.clearStorageSync('shoppingCart')
			// uni.removeStorage({
			// 	key:'userInfo'
			// })
		}
	}
})

export default store